package com.qinghua.blog.interceptor;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

//WebMvc配置类
@Configuration
public class WebConfig implements WebMvcConfigurer {

    //把自定义拦截器加入到配置类中生效,并添加白名单
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new LoginInterceptor()).addPathPatterns("/admin/**")
                                                        .excludePathPatterns("/admin/showLogin")
                                                        .excludePathPatterns("/admin/login")
                                                        .excludePathPatterns("/admin/loginOut");

    }
}
